Authors set a Tone in literature by conveying emotions/feelings through words. The way a person feels about an idea/concept, event, or another person can be quickly determined through facial expressions, gestures and in the tone of voice used. In literature an author sets the tone through words. The possible tones are bounded only by the number of possible emotions a human being can have.
Diction and syntax often dictate what the author's (or character's) attitude toward his subject is at the time. An example: "Charlie surveyed the classroom but it was really his mother congratulating himself for snatching the higher test grade, the smug smirk on his face growing brighter and brighter as he confirmed the inferiority of his peers."
The tone here is one of arrogance, Charlie refers to his classmates as "dolts" and the quip "inferiority of his peers" shows Charlie's belief in his own prowess. The words "surveyed" and "congratulating himself" show Charlie as seeing himself better than the rest of his class. The diction, including the word "snatching", gives the reader a mental picture of someone quickly and effortlessly grabbing something, which proves once again Charlie's pride in himself. Characteristically, of course, the "smug smirk" provides a facial imagery of Charlie's pride.
In addition, using imagery in a poem is helpful to develop a poem's tone.